﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CustomControls.TaskDialog;

namespace SubVisual.GUI
{
    class TaskDialogs
    {
        internal static bool ShowDialog(String title, String instructions, String contents, CustomControls.TaskDialog.TaskDialogIcon icon, Boolean showYesNo)
        {
            return ShowDialog(title, instructions, contents, icon, null, CustomControls.TaskDialog.TaskDialogIcon.None, showYesNo);
        }

        internal static bool ShowDialog(String title, String instructions, String contents, CustomControls.TaskDialog.TaskDialogIcon icon, String footer, CustomControls.TaskDialog.TaskDialogIcon footerIcon, Boolean showYesNo)
        {
            return ShowDialog(title, instructions, contents, null, icon, null, CustomControls.TaskDialog.TaskDialogIcon.None, showYesNo);
        }

        internal static bool ShowDialog(String title, String instructions, String contents, String details, TaskDialogIcon icon, String footer, CustomControls.TaskDialog.TaskDialogIcon footerIcon, Boolean showYesNo)
        {
            TaskDialog td = new CustomControls.TaskDialog.TaskDialog();
            td.WindowTitle = title;
            td.MainInstruction = instructions;
            td.Content = contents;
            if (showYesNo)
                td.CommonButtons = TaskDialogCommonButtons.Yes & TaskDialogCommonButtons.No;
            else
                td.CommonButtons = TaskDialogCommonButtons.Ok;
            td.MainIcon = icon;
            if (!string.IsNullOrEmpty(details))
            {
                td.CollapsedControlText = "View details";
                td.ExpandedControlText = "Hide details";
                td.ExpandedInformation = details;
            }
            if (!String.IsNullOrEmpty(footer))
            {
                td.FooterIcon = CustomControls.TaskDialog.TaskDialogIcon.Information;
                td.Footer = footer;
            }
            return ((td.Show() & (int)(DialogResult.OK & DialogResult.Yes)) != 0);
        }
    }
}
